<!--
    /**
     * 字典下拉选择组件：继承自树下拉选择组件
     * @see @/components/OptionSelect
     * 使用方法
     * <dict-option-select v-model="form.entry.validStatus" dictField="validStatus" :disabled="!form.editable" ></dict-option-select>
     */
-->

<script>
import OptionSelect from "@/components/OptionSelect";
import *  as systemDictionaryApi from '../apis/dictionary'

export default {
  name: "DictOptionSelect",
  extends: OptionSelect,
  props: {
    optionProps: {
      type: Object, default() {
        return {key: 'value', value: 'value', label: 'name'}
      }
    },
    dictField: String
  },
  data() {
    return {
      nodeData: []
    }
  },
  mounted() {
    if (!(this.optionData && this.optionData.length > 0)) {
      this.loadData()
    }
  },
  methods: {
    loadData() {
      systemDictionaryApi.list({parentId: this.dictField}).then(response => {
        this.$set(this, "nodeData", response.result)
        /*this.nodeData = response.result
        if (this.defaultValue) { //有回显值
            this.defaultCheck();
        }*/
      })
    }
  },
}
</script>

<style lang="scss" scoped>

</style>